<template>
    <div>
      <div class="wrap headerwrap">
        <!-- logo -->
          <h1>
            <img src="../assets/img/indexLogo.6f8ac4f0.png">
          </h1>
          <!-- navs -->
          <ul class="navs">
            <li :class="{active : $route.path === '/home'}" @click="$router.push('/home')">首页</li>
            <li :class="{active : $route.path === '/goods'}" @click="$router.push('/goods')">全部商品</li>
            <li :class="{active : $route.path === '/user'}" @click="$router.push('/user')">个人中心</li>
            <li :class="{active : $route.path === '/order'}" @click="$router.push('/order')">我的订单</li>
            <li :class="{active : $route.path === '/free'}" @click="$router.push('/free')">专属福利</li>
          </ul>
          <!-- search -->
          <div class="search">
            <input type="text" placeholder="请输入关键字" v-model="searchVal">
            <span @click="search"><img src="../assets/img/search.png"></span>
          </div>
      </div>
    </div>
  </template>
  
  <script>
    export default {
  data(){
    return {
      searchVal: "",
    }
  },
  methods:{
    search() {
      this.$router.push(`/goods?keyword=${this.searchVal}`)
    }
  }
}
  </script>
  
  <style lang="less" conped>
  .headerwrap{
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 118px;
    cursor: pointer;
    font-style: 14px;
    font-family: SourceHanSansSC;
    .navs {
      display: flex;
      justify-content: space-between;
      width: 500px;
      .active{
        color:#0A328E ;
      }
    }
    .search{
      display: flex;
      input{
        width: 214px;
        height: 40px;
        border: 1px solid #DEDEDE;
        border-radius: 20px 0px 0px 20px;
      }
      span{
        width: 50px;
        height: 44px;
        background: #0A328E;
        border-radius: 0px 20px 20px 0px;
        img{
          margin: 14px;
        }
      }
    }
  }
  </style>